﻿@model
@{
    ViewBag.Title = "登录";
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>生意汇-国内领先商机服务平台</title>
    <meta name="description" content="生意汇-国内领先商机服务平台—用户登录" />
    <meta name="keywords" content="生意汇-国内领先商机服务平台—用户登录" />
    <link rel="stylesheet" href="/css/global.css" type="text/css" />
    <link rel="stylesheet" href="/css/login.css" type="text/css" />
    <link href="/Script/Validform_v5.3.2/css/style.css" rel="stylesheet" type="text/css" />
    <script src="/Script/jquery.min.js" type="text/javascript"></script>
    <script src="/Script/Validform_v5.3.2/js/Validform_v5.3.2.js" type="text/javascript"></script>
    <script src="/Script/artDialog/jquery.artDialog.source.js?skin=chrome" type="text/javascript"></script>
    <script src="/Script/district.js" type="text/javascript"></script>
</head>
<body>
        <!--S登录头部-->
        <div class="login_head">
            <div class="g_logo">
                <a href="#" title="生意汇">
                    <img src="/images/login/logo.jpg" alt="生意汇" /></a></div>
            <div class="welcome">
                欢迎登录</div>
            <div class="tel_login">
                <img src="/images/login/tel.jpg" /></div>
        </div>

        <!--E登录头部-->
        <div class="login_con">
            <div class="login_con_l">
                <img src="/images/login/con_img.jpg" /></div>
            <div class="login_con_r">
                <div class="login_name">
                    <a href="#" target="_self" class="forget_user">忘记用户名？</a><span>用户名</span></div>
                <div class="login_name_input">
                    <input type="text" name="txtUserName" id="txtUserName" class="login_input" />
                </div>
                <div id="new_usernameTip" class="onFocus_login">
                     <span class="Validform_checktip"></span>
                  </div>
                <div class="login_name">
                    <a href="#" target="_self" class="forget_user">忘记密码？</a><span>登录密码</span>
                </div>
                <div class="login_name_input">
                    <input type="password" name="txtPwd" id="txtPwd" class="login_input" type="password" />

                </div>
                <div id="new_passwdTip" class="onError_login" style="display: none;">
                    用户名或密码不能为空!</div>
                <div class="login_name">
                    <a href="#" target="_self" class="forget_user"></a><span>验证码</span></div>
                <div class="login_name_input">
                    <input name="txtCode" type="text" id="txtCode" size="5" maxlength="5" class="login_input"
                        style="width: 70px;" />
                </div>
                <div class="login_name_tit">
                    <ul>
                        <li>
                            <img id="imgCode" src="/CheckCode/CreateCodeImg" alt="验证码" /></li>
                        <li style="100px;"><a id="Change" href="###">看不清,换一张</a></li>
                    </ul>
                </div>
                <div class="login_rem">
                    <input id="rememberMe" name="txtCode" type="checkbox" value="0" />
                    <label style="margin-left: 5px;">
                        记住用户名和密码</label>
                </div>
                <div class="login_bt" align="center">
                    <a id="btn_Login" href="javascript:CheckLogin();">
                        <img src="/images/login/login1.jpg" onmouseover="this.src='images/login/login2.jpg';"
                            onmouseout="this.src='images/login/login1.jpg';" />
                    </a>
                </div>
                <div class="login_unite">
                    <a class="login_QQ" href="#">
                        <img src="/images/login/QQ.jpg" alt="QQ登录" />QQ登录</a> <a class="login_wb" href="#">
                            <img src="/images/login/wb.jpg" alt="新浪微博登录" />新浪微博登录</a> <a class="login_entry" href="@Url.Action("Register")" alt="免费注册">
                                免费注册</a></div>
            </div>
        </div>
        <div class="clear">
        </div>
        <div class="opinion">
            <a href="#">欢迎对登录页面提出宝贵建议</a></div>
        <div class="clear">
        </div>
        <div class="login_footer">
            <a href="#">生意汇介绍</a><span>|</span><a href="#">广告服务</a><span>|</span><a href="#">联系我们</a><span>|</span><a
                href="#">产品信息</a><span>|</span><a href="#">求购信息</a><span>|</span> <a href="#">明星企业</a><span>|</span><a
                    href="#">疑难解答</a><span>|</span><a href="#">公司新闻</a><span>|</span><a href="#">帮助中心</a><span>|</span><a
                        href="#">友情链接</a> <span>|</span><a href="#">意见反馈</a> <span>|</span>
            <a href="#">站长地图</a>
        </div>


</body>
    <script type="text/javascript">
        document.domain = 'syh876.com';
        $(function () {
          
            $("#txtUserName,#txtPwd,#txtCode").keypress(function (e) {
                if (e.keyCode == 13) {
                    CheckLogin();
                    return false;
                }
            });
        });


        function CheckLogin() {
            //记住密码
            if ($("#rememberMe").attr("checked") == "checked") {
                $("#rememberMe").val(1);
            } else {
                $("#rememberMe").val(0);
            }
            //登录
            var LoginName = Trim($("#txtUserName").val());
            var LoginPwd = Trim($("#txtPwd").val());
            var ImgCode = Trim($("#txtCode").val());
            var ErrCount = 0; var ErrMsg = "";
            if (LoginName.length == 0 && LoginPwd.length == 0 && ImgCode.length == 0)
            { ErrCount += 1; ErrMsg = "请输入登陆信息"; }
            else {
                if (!CheckStrLeng(LoginName, 5, 25)) { ErrCount += 1; ErrMsg = "登录名格式或长度有误"; }
                if (!CheckStrLeng(LoginPwd, 6, 25)) { if (ErrCount == 0) { ErrMsg = "密码由6-20个字符组成。"; ErrCount += 1; } else { ErrCount += 1; } }
                if (ImgCode.length != 5) { if (ErrCount == 0) { ErrMsg = "验证码错误"; ErrCount += 1; } else { ErrCount += 1; } }
            }

            if (ErrCount == 0) {
                ShowErr("", 1);
         
                $.ajax({
                    url: "/ajax/Account/CheckIn.ashx",
                    data: { txtUserName: LoginName, txtPwd: LoginPwd, txtCode: ImgCode, check: $("#rememberMe").val(), _t: new Date() },
                    type: "GET",
                    async: true,
                    cache: false,
                    success: function (d) {
                        var v = d.split("|");
                        if (v[0].toString() == "0") {
                       
                            ChangeImgCode(); ShowErr(v[1].toString(), 0);
                        } else if (v[0].toString() == "2") {
                         
                            ChangeImgCode();
                            ShowErr(v[1].toString(), 2);
                        }
                        else {
                        
                            parent.window.location.replace("<%=backurl %>");
                        }
                    }
                });
            } else { ShowErr(ErrMsg, 0); }
        }
        //显示或隐藏错误提示区域
        function ShowErr(msg, flag) {
            if (flag == 0) {
                $("#errfr").show();
                $("#errtxt").html("<span class=\"onError_ico\">&nbsp;</span>" + msg);
            }
            else if (flag == 2) {
                $("#errfr").show();

                $("#errtxt").html("<span class=\"onError_ico\">&nbsp;</span>" + msg + "&nbsp;&nbsp;&nbsp;&nbsp;");

            }
            else { $("#errfr").hide(); }
        }
        //取消登录检测时的遮盖
        function unmask_login() {
            $("#loginiframe").unmask();
        }
        //刷新验证码
        $("#Change").click(function () {
            document.getElementById('imgCode').src = '/CheckCode/CreateCodeImg?' + Math.random();
        });
        //去除空格字符
        function Trim(info) {
            return info.replace(/(^\s*)|(\s*$)/g, "");
        }
        //检测长度
        function CheckStrLeng(valueStr, min, max) {
            var svLeng = valueStr.toString().length;
            if (svLeng >= min && svLeng <= max) { return true; } else { return false; }
        }
    </script>
</html>
